package com.example.application;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    private TextView textView;
    private ImageView imaDog;
    private Button btnNext;
    private int[] dogimgs={R.drawable.dog1,R.drawable.dog2,R.drawable.dog3,R.drawable.dog4,R.drawable.dog5,};
    public int temp=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        textView=findViewById(R.id.text1);

        imaDog=findViewById(R.id.imaDog);
        btnNext=findViewById(R.id.btn);

        btnNext.setOnClickListener(
                new View.OnClickListener() {

                    @Override
                    public void onClick(View view) {
                        temp = (temp+1)%dogimgs.length;
                        imaDog.setImageResource(dogimgs[temp]);
                    }
                }
        );

    }
}
